package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.Projects;
import com.ruoyi.system.mapper.ProjectsMapper;
import com.ruoyi.system.service.IProjectsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * projectsService业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-05
 */
@Service
public class ProjectsServiceImpl implements IProjectsService 
{
    @Autowired
    private ProjectsMapper projectsMapper;

    @Override
    public List<Projects> selectValid(String ppprojectname,String ppprojecttype, String ppfabushijian, String pppublishingunit, String pppaixu, int ppStartIndex, int ppPageSize) {
        return projectsMapper.selectValid(ppprojectname,ppprojecttype, ppfabushijian, pppublishingunit, pppaixu, ppStartIndex, ppPageSize);
    }

    @Override
    public int countValid( String ppprojectname,String ppprojecttype,String ppfabushijian, String pppublishingunit) {
        Object mmCount = projectsMapper.countValid(ppprojectname,ppprojecttype,ppfabushijian, pppublishingunit);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }

    @Override
    public List<Projects> selectAll(String ppprojectname,String ppprojecttype, int ppStartIndex,  int ppPageSize) {
        return projectsMapper.selectAll(ppprojectname,ppprojecttype,ppStartIndex, ppPageSize);
    }

    @Override
    public int countAll(String ppprojectname, String ppprojecttype) {
        Object mmCount = projectsMapper.countAll(ppprojectname,ppprojecttype);
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }

    @Override
    public int getMaxNumber() {
        Object mmCount = projectsMapper.getMaxNumber();
        return mmCount == null ? 0 : Integer.parseInt(mmCount.toString());
    }

    /**
     * 查询projects
     * 
     * @param id projects主键
     * @return projects
     */
    @Override
    public Projects selectProjectsById(String id)
    {
        return projectsMapper.selectProjectsById(id);
    }

    /**
     * 查询projects列表
     * 
     * @param projects projects
     * @return projects
     */
    @Override
    public List<Projects> selectProjectsList(Projects projects)
    {
        return projectsMapper.selectProjectsList(projects);
    }

    /**
     * 新增projects
     * 
     * @param projects projects
     * @return 结果
     */
    @Override
    public int insertProjects(Projects projects)
    {
        projects.setCreateTime(DateUtils.getNowDate());
        return projectsMapper.insertProjects(projects);
    }

    /**
     * 修改projects
     * 
     * @param projects projects
     * @return 结果
     */
    @Override
    public int updateProjects(Projects projects)
    {
        projects.setUpdateTime(DateUtils.getNowDate());
        return projectsMapper.updateProjects(projects);
    }

    /**
     * 批量删除projects
     * 
     * @param ids 需要删除的projects主键
     * @return 结果
     */
    @Override
    public int deleteProjectsByIds(String[] ids)
    {
        return projectsMapper.deleteProjectsByIds(ids);
    }

    /**
     * 删除projects信息
     * 
     * @param id projects主键
     * @return 结果
     */
    @Override
    public int deleteProjectsById(String id)
    {
        return projectsMapper.deleteProjectsById(id);
    }
}
